runOnStartup(async runtime => {
    runtime.addEventListener("tick", () => tick())
    runtime.getLayout("MainLevel").addEventListener("afterlayoutstart", () => init())
});
function tick() {
    if (runtime.layout.name != "MainLevel") return;
}
function init() {
    Camear_CameraShke.isshake=false
}
globalThis.Camear_CameraShke = {
    shake: function () {
        Camear_CameraShke.isshake=true
        let playerMask = runtime.objects.PlayerCollision.getFirstInstance()
        let camera3D = runtime.objects.DCamera
        let shakeTime = setInterval(() => {
            let shakeOffset = MyMath.randomNum(-0.5, 3)
            let camX = runtime.layout.width / 2
            let camY = runtime.layout.height / 2 + 360
            let camZ = 100
            let lookX = playerMask.x + shakeOffset
            let lookY = playerMask.y + shakeOffset
            let lookZ = 8
            let upX = 0
            let upY = 0
            let upZ = 1
            camera3D.lookAtPosition(camX, camY, camZ, lookX, lookY, lookZ, upX, upY, upZ)
            setTimeout(() => {
                clearInterval(shakeTime)
                Camear_CameraShke.isshake=false
            }, 500);
        }, 10);
    }
}
export default Camear_CameraShke